﻿using System.Windows.Forms;

namespace UsercontrolDatalinkage
{
    public partial class Icon : UserControl,IData
    {
        public delegate void ValChangedEventHandler(int value);
        public event ValChangedEventHandler PVChanged;
        public event ValChangedEventHandler MVChanged;

        private int pv;

        public int PV
        {
            get { return pv; }
            set 
            {
                if (pv != value)
                {
                    pv = value;
                    lbl_PV_Val.Text = pv.ToString();
                    PVChanged?.Invoke(pv);
                }
            }
        }

        private int mv;

        public int MV
        {
            get { return mv; }
            set 
            {
                if (mv != value)
                {
                    mv = value;
                    lbl_MV_Val.Text = mv.ToString();
                    MVChanged?.Invoke(mv);
                }
            }
        }

        public Icon()
        {
            InitializeComponent();
        }
    }
}
